<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
    pageContext.setAttribute("PAGETITLE", "部门管理");
%>
<%@ include file="/pages/include/header.jsp" %>

<style>
<!--
/* your css code */
-->
</style>

<script type="text/javascript">
<!--
function cmd(command, params) {
    switch (command) {
	    case "edit":
	        var url = ctx;
		    if (!params.deptId) {
			    url += "/pages/system/deptRoot.jsp";
            } else {
                url += "/action/dept.do?method=edit&deptId=" + params.deptId;
            }
	        $E("main").src = url;
	        break;
    }
}

$(document).ready(function () {
    $("#action_result").animate({left: -100}, 0);
});
//-->
</script>

<sql:query var="deptList" dataSource="${dataSource}">
SELECT D.* FROM CT_DEPARTMENT D
</sql:query>

<body>

    <div class="page_header">${PAGETITLE}</div>
    
    <div class="page_buttons">
        <div id="action_result" class="action_result">${requestScope.ACTION_RESULT}</div>
        <input type="button" onclick="$('#form').submit()"
            value="${empty form.map.form.deptId ? '保存' : '更新'}" />
    </div>

    <div class="index_left">
        <ul>
            <li><a href="javascript:cmd('edit', {deptId: ''})">一级部门</a></li>
            <c:forEach var="item" items="${deptList.rows}" varStatus="vs">
            <li><a href="javascript:cmd('edit', {deptId: '${item.DEPTID}'})">${item.DEPTNAME}</a></li>
            </c:forEach>
        </ul>
    </div>
    
    <div class="index_main">
        <iframe id="main" scrolling="auto" frameborder="0" width="100%" height="100%"
            src="${ctx}/pages/system/deptRoot.jsp"></iframe>
    </div>

</body>

<script type="text/javascript">
<!--
// your js code
//-->
</script>

<%@ include file="/pages/include/footer.jsp" %>
